<!DOCTYPE html>
<html lang="cn">
<head>
    <meta charset="UTF-8">
    <title>AJAX</title>
</head>
<body>
    <h1>AJAX</h1>
    <hr>
    <script>
    	var xhr = new XMLHttpRequest();
    	// console.log(xhr);
    	// 事件回调
    	xhr.onreadyschange = function(){
    		// console.log(xhr.readytate);
    		if(xhr.readyState == 4){
    			if(xhr.status == 200){
    				//获取响应文本
    				alert(xhr.responseText);
    			}
    		}
    	}
    	//请求初始化
    	xhr.open('get','./php/1222.php',true);
    	//正是发送
    	xhr.send();
    </script>
    

</body>
</html>